package _2022.contest.weekly.contest_291._6047_移除指定数字得到的最大结果;

/**
 * @author： YHSimon
 * @date： 2022-05-01 11:09
 */
public class Solution {
    public String removeDigit(String number, char digit) {
        String ans="";
        for (int i = 0; i < number.length(); i++) {
            StringBuilder sb=new StringBuilder();
            if(number.charAt(i)==digit){
                sb.append(number, 0, i);
                sb.append(number.substring(i+1));
                String tmp=sb.toString();
                if(tmp.compareTo(ans)>0){
                    ans=tmp;
                }
            }

        }
        return ans;
    }

    public static void main(String[] args) {
        Solution s = new Solution();
        System.out.println(s.removeDigit("1231", '1'));
    }
}
